<template>
  <div class="app-container">
    <div v-show="tab_view==1" class="customContainer">
      <!-- 搜索头 -->
      <el-form :inline="true" :model="formInline" size="small">
        <el-form-item>
          <el-date-picker style="width:240px" v-model="pickerDate" value-format="yyyy-MM-dd" type="daterange" align="right" unlink-panels range-separator="-"
            :clearable="false" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>
        <el-form-item>
          <span style="color: #888;">门店：</span>
          <el-select placeholder="选择门店" v-model="formInline.store_id" style="width:300px" filterable>
            <el-option v-for="item in store_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <span style="color: #888;">类型：</span>
          <el-select v-model="type" multiple collapse-tags style="width:150px">
            <el-option v-for="item in type_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <span style="color: #888;">状态：</span>
          <el-select v-model="status" multiple collapse-tags style="width:140px">
            <el-option v-for="item in status_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input v-model="formInline.name" placeholder="请输入名称" style="width:150px;" clearable @keyup.enter.native="searchClick"></el-input>
        </el-form-item>
        <el-form-item>
          <dj-button size="small" @search="searchClick" />
        </el-form-item>
        <el-button class="pull-right" type="primary" size="small" @click="addTypeClick()">新增商品</el-button>
      </el-form>
      <el-table highlight-current-row :data="list" border size="mini" @sort-change="tableSort" v-loading.body="listLoading">
        <el-table-column align="center" label='序号' width="50">
          <template slot-scope="scope">{{scope.$index+1+(currentPage-1)*20}}</template>
        </el-table-column>
        <el-table-column align="center" label="名称" prop="name"></el-table-column>
        <el-table-column align="center" label="类型" prop="type">
          <template slot-scope="scope">{{scope.row.type_name}}</template>
        </el-table-column>
        <el-table-column align="center" label="说明" prop="describe"></el-table-column>
        <el-table-column align="center" label="更新时间" prop="update_time" sortable="custom"></el-table-column>
        <el-table-column align="center" label="状态" prop="status"></el-table-column>
        <el-table-column align="center" label='操作' width="330">
          <template slot-scope="scope">
            <el-button @click="infoClick(3,scope.row.goods_id,scope.row.second_type)" type="primary" plain size="mini">详情</el-button>
            <el-button @click="infoClick(2,scope.row.goods_id,scope.row.second_type)" type="primary" plain size="mini">修改</el-button>
            <el-button @click="goSale(2,scope.row.goods_id)" type="primary" plain size="mini">查看销售</el-button>
            <el-button @click="goSale(1,scope.row.goods_id)" type="primary" plain size="mini">新建销售</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-show="tab_view==2" class="customContainer">
      <el-button class="pull-left" type="primary" size="small" @click="backClick">返 回</el-button>
      <div class="tab_title">{{top_title}}</div>
      <div v-show="isNew">
        <dj-tab :data='step_list' :isNew='isNew' :tab_step='tab_step' @goStep='goStep'></dj-tab>
      </div>
      <div v-show="tab_step==1" class="info">
        <el-form :model="basicForm" ref="basicForm" :rules="rules" :disabled="isNew==3||isDisabled" label-width="80px">
          <el-form-item label="名称" prop="name">
            <el-input :disabled="isSelled" :maxlength="20" placeholder="请输入名称" v-model="basicForm.name" style="width:90%"></el-input>
          </el-form-item>
          <el-form-item v-show="basicForm.second_type==7" label="别称" prop="add_item">
            <el-input :disabled="isSelled" :maxlength="20" placeholder="请输入别称，别称会展示在小程序商品左侧方框区域" v-model="infoForm.add_item" style="width:90%"></el-input>
          </el-form-item>
          <el-form-item label="说明" prop="describe">
            <el-input :disabled="isSelled" type="textarea" :maxlength="150" :rows="3" v-model="basicForm.describe" style="width:90%"></el-input>
          </el-form-item>
          <el-form-item v-show="basicForm.second_type==2" label="卡类型" prop="card_type_id">
            <el-select :disabled="isSelled" v-model="basicForm.card_type_id" style="width:240px" @change="cardTypeChange">
              <el-option-group v-for="group in card_type_list" :key="group.type" :label="group.type_name">
                <el-option v-for="item in group.list" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-option-group>
            </el-select>
            <span v-show="isCancel" class="info_remark">该卡余额为0时自动注销</span>
            <span v-show="!isLimit" class="info_remark">该卡在有效期内没有使用限制</span>
          </el-form-item>
          <el-form-item v-show="basicForm.second_type!=2&&basicForm.second_type!=5&&basicForm.second_type!=7" label="卡类型" prop="more_card_type_id">
            <el-select :disabled="isSelled" v-model="basicForm.more_card_type_id" multiple style="width:240px" @change="cardTypeChange">
              <el-option-group v-for="group in basicForm.second_type==3?pay_card_type:card_type_list" :key="group.type" :label="group.type_name">
                <el-option v-for="item in group.list" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-option-group>
            </el-select>
          </el-form-item>
        </el-form>
        <el-form :model="infoForm" ref="infoForm" :rules="rules" :disabled="isNew==3||isDisabled" label-width="80px">
          <el-form-item v-show="basicForm.second_type<4||basicForm.second_type==5" label="售价" prop="pay_money">
            <el-input :disabled="isSelled" :maxlength="9" v-model="infoForm.pay_money" style="width:240px;margin-right:10px"></el-input>元
          </el-form-item>
          <el-form-item label="优先级" prop="priority">
            <el-input :maxlength="3" v-model.number="infoForm.priority" style="width:240px;"></el-input>
            <span style="margin-left:10px">填写1~999的数字，数字越小，优先级越高</span>
          </el-form-item>
          <div class="info_optional">
            <div v-show="basicForm.second_type>=6&&basicForm.second_type!=8" class="op_title">获得方式（至少勾选一项）</div>
            <el-form-item v-show="basicForm.second_type>=6&&basicForm.second_type!=8" label-width="0">
              <el-form-item label-width="0">
                <el-col :span="6" class="op_col">
                  <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_buy,6)"
                    label="现金购买" v-model="infoForm.support_buy">
                  </el-checkbox>
                  <el-form-item style="margin-left:100px" ref="get_money" prop="pay_money">
                    <el-input :disabled="isSelled" v-show="infoForm.support_buy==='1'" :maxlength="6" v-model="infoForm.pay_money"
                      style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_buy==='1'">元</span>
                  </el-form-item>
                </el-col>
                <el-col :span="6" class="op_col">
                  <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_score,7)"
                    label="积分兑换" v-model="infoForm.support_score">
                  </el-checkbox>
                  <el-form-item style="margin-left:100px" ref="get_score" prop="pay_score">
                    <el-input :disabled="isSelled" v-show="infoForm.support_score==='1'" :maxlength="6" v-model.number="infoForm.pay_score"
                      style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_score==='1'">分</span>
                  </el-form-item>
                </el-col>
                <el-col :span="6" class="op_col">
                  <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_ticket,8)"
                    label="彩票兑换" v-model="infoForm.support_ticket">
                  </el-checkbox>
                  <el-form-item style="margin-left:100px" ref="get_ticket" prop="pay_ticket">
                    <el-input :disabled="isSelled" v-show="infoForm.support_ticket==='1'" :maxlength="6" v-model.number="infoForm.pay_ticket"
                      style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_ticket==='1'">张</span>
                  </el-form-item>
                </el-col>
              </el-form-item>
              <el-form-item v-show="basicForm.second_type>6" label-width="0" prop="voucher">
                <div class="op_voucher">
                  <el-checkbox true-label="1" false-label="0" :disabled="isSelled||basicForm.second_type==7" class="op_checked" @change="opCheckedChange(pay_voucher,9)" label="凭证兑换"
                    v-model="pay_voucher">
                  </el-checkbox>
                  <el-form-item v-show="pay_voucher==='1'" class="op_voucher_item" style="margin-left:20px" ref="pay_voucher_name" prop="pay_voucher_name"
                    label="凭证名称">
                    <el-input :disabled="isSelled" v-show="pay_voucher" :maxlength="16" v-model="infoForm.pay_voucher_name"
                      style="width:320px;margin-right:10px"></el-input>
                  </el-form-item>
                  <el-form-item v-show="pay_voucher==='1'" class="op_voucher_item" style="margin-left:110px" ref="pay_voucher_num" prop="pay_voucher_num"
                    label="凭证数量">
                    <el-input :disabled="isSelled" v-show="pay_voucher" :maxlength="4" v-model.number="infoForm.pay_voucher_num"
                      style="width:100px;margin-right:10px"></el-input>
                  </el-form-item>
                </div>
              </el-form-item>
            </el-form-item>
            <div v-show="basicForm.second_type!=4&&basicForm.second_type!=7" class="op_title">{{basicForm.second_type==8?"卡":""}}获得</div>
            <el-form-item v-show="basicForm.second_type!=4&&basicForm.second_type!=5&&basicForm.second_type!=7" label-width="0">
              <el-col v-show="choose_card_type==0" :span="6">
                <el-form-item label="通用币本币" label-width="82px" prop="add_coins">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_coins" style="width:100px;margin-right:10px"></el-input>个
                </el-form-item>
              </el-col>
              <el-col v-show="choose_card_type==0" :span="6">
                <el-form-item label="通用币赠币" label-width="100px" prop="add_giving_coins">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_giving_coins" style="width:100px;margin-right:10px"></el-input>个
                </el-form-item>
              </el-col>
              <el-col v-show="choose_card_type==0" :span="6">
                <el-form-item label="门店专用币" label-width="100px" prop="add_special_coins">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_special_coins" style="width:100px;margin-right:10px"></el-input>个
                </el-form-item>
              </el-col>
              <el-col v-show="choose_card_type==0" :span="6">
                <el-form-item label="专用币有效期" label-width="100px" prop="add_special_coins_days">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_special_coins_days" style="width:100px;margin-right:10px">
                  </el-input>天
                </el-form-item>
              </el-col>
              <el-col :span="6" v-show="choose_card_type==1">
                <el-form-item label="通用本次" label-width="70px" prop="add_times">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_times" style="width:100px;margin-right:10px"></el-input>次
                </el-form-item>
              </el-col>
              <el-col :span="6" v-show="choose_card_type==1">
                <el-form-item label="通用赠次" label-width="70px" prop="add_giving_times">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_giving_times" style="width:100px;margin-right:10px"></el-input>次
                </el-form-item>
              </el-col>
              <el-col :span="6" v-show="choose_card_type==2">
                <el-form-item label="通用本星" label-width="70px" prop="add_star">
                  <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_star" style="width:100px;margin-right:10px"></el-input>个
                </el-form-item>
              </el-col>
              <el-col :span="6" v-show="choose_card_type==2">
                <el-form-item label="通用赠星" label-width="70px" prop="add_giving_stars">
                <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_giving_stars" style="width:100px;margin-right:10px"></el-input>个
              </el-form-item>
              </el-col>
            </el-form-item>
            <el-form-item label-width="0" v-show="basicForm.second_type==5">
              <el-col :span="6">
                <el-form-item label="成人票" label-width="54px" prop="add_adult_tickets">
                  <el-input :disabled="isSelled" :maxlength="4" v-model.number="infoForm.add_adult_tickets" style="width:100px;margin-right:10px"></el-input>张
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="儿童票" label-width="100px" prop="add_child_tickets">
                  <el-input :disabled="isSelled" :maxlength="4" v-model.number="infoForm.add_child_tickets" style="width:100px;margin-right:10px"></el-input>张
                </el-form-item>
              </el-col>
            </el-form-item>
            <el-form-item label="陪同票" label-width="54px" prop="support_accompany_buy" v-show="basicForm.second_type==5">
              <el-col :span="12" class="op_col">
                <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_accompany_buy,10)"
                  label="现金购买" v-model="infoForm.support_accompany_buy"></el-checkbox>
                <el-form-item style="margin-left:100px" ref="pay_accompany_money" prop="pay_accompany_money">
                  <el-input :disabled="isSelled" v-show="infoForm.support_accompany_buy==='1'" :maxlength="7" v-model="infoForm.pay_accompany_money"
                    style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_accompany_buy==='1'">元</span>
                </el-form-item>
              </el-col>
            </el-form-item>
            <!-- <el-form-item label-width="0" v-show="basicForm.second_type==7">
              <el-col :span="6">
                <el-form-item label="物品名称" label-width="68px" prop="add_item">
                  <el-input :disabled="isSelled" :maxlength="20" v-model="infoForm.add_item" style="width:320px;margin-right:10px"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="数量" label-width="100px" prop="add_item_num">
                  <el-input :disabled="isSelled" :maxlength="4" v-model.number="infoForm.add_item_num" style="width:100px;margin-right:10px"></el-input>
                </el-form-item>
              </el-col>
            </el-form-item> -->
            <el-form-item v-show="basicForm.second_type==2" label="有效期" label-width="54px" prop="add_renewal_days">
              <el-input :disabled="isSelled" :maxlength="4" v-model.number="infoForm.add_renewal_days" style="width:240px;margin-right:10px"></el-input>天
              <span class="info_remark">{{effect_text}}</span>
            </el-form-item>
            <div v-show="basicForm.second_type==2" class="remark">可用时间为购买当天到最后一天的23:59:59，如果设置为0，即表示仅限购买当天使用</div>
            <div v-show="basicForm.second_type==4" class="op_title">续期</div>
            <el-form-item v-show="basicForm.second_type==4" label="方式" label-width="40px" prop="renewal_type">
              <el-col :span="6" class="op_col">
                <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_buy,4)"
                  label="缴费续期" v-model="infoForm.support_buy"></el-checkbox>
                <el-form-item style="margin-left:100px" ref="money_renewal" prop="pay_money">
                  <el-input :disabled="isSelled" v-show="infoForm.support_buy==='1'" :maxlength="6" v-model="infoForm.pay_money"
                    style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_buy==='1'">元</span>
                </el-form-item>
              </el-col>
              <el-col :span="6" class="op_col">
                <el-checkbox true-label="1" false-label="0" :disabled="isSelled" class="op_checked" @change="opCheckedChange(infoForm.support_score,5)"
                  label="积分续期" v-model="infoForm.support_score"></el-checkbox>
                <el-form-item style="margin-left:100px" ref="pay_score" prop="pay_score">
                  <el-input :disabled="isSelled" v-show="infoForm.support_score==='1'" :maxlength="6" v-model.number="infoForm.pay_score"
                    style="width:100px;margin-right:10px"></el-input><span v-show="infoForm.support_score==='1'">分</span>
                </el-form-item>
              </el-col>
            </el-form-item>
            <el-form-item v-show="basicForm.second_type==4" label-width="40px" label="天数">
              <el-form-item label="有效期延长" label-width="100px" prop="add_renewal_days">
                <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_renewal_days" style="width:100px;margin-right:10px"></el-input>天
                <span class="info_remark">{{effect_text}}</span>
              </el-form-item>
            </el-form-item>
            <div v-show="basicForm.second_type!=7" class="op_title">{{basicForm.second_type==8?"账户获得":"赠送（选填）"}}</div>
            <el-form-item v-show="basicForm.second_type!=7" label-width="0" prop="add_get">
              <el-col :span="6" class="op_col">
                <el-checkbox :disabled="isSelled" class="op_checked" @change="opCheckedChange(add_score_type,1)" label="积分" v-model="add_score_type">
                </el-checkbox>
                <el-form-item style="margin-left:80px" ref="add_score" prop="add_score">
                  <el-input :disabled="isSelled" v-show="add_score_type" :maxlength="6" v-model.number="infoForm.add_score"
                    style="width:100px;margin-right:10px"></el-input><span v-show="add_score_type">分</span>
                </el-form-item>
              </el-col>
              <el-col :span="6" class="op_col">
                <el-checkbox :disabled="isSelled" class="op_checked" @change="opCheckedChange(add_ticket_type,2)" label="彩票" v-model="add_ticket_type">
                </el-checkbox>
                <el-form-item style="margin-left:80px" ref="add_ticket" prop="add_ticket">
                  <el-input :disabled="isSelled" v-show="add_ticket_type" :maxlength="6" v-model.number="infoForm.add_ticket"
                    style="width:100px;margin-right:10px"></el-input><span v-show="add_ticket_type">张</span>
                </el-form-item>
              </el-col>
            </el-form-item>
            <div v-show="basicForm.second_type==3" class="op_title">办卡（选填）</div>
            <el-form-item v-show="basicForm.second_type==3" label-width="0" prop="support_card">
              <el-col :span="6" class="op_col">
                <el-checkbox @change="opCheckedChange(infoForm.support_card,11)" :disabled="supCardDisabled||isSelled" true-label="1" false-label="0" label="支持办卡" v-model="infoForm.support_card"></el-checkbox>
                <span v-show="basicForm.more_card_type_id.length>1" class="info_remark">办卡只支持单一卡类型选择</span>
              </el-col>
              <el-col :span="12">
                <el-form-item v-show="infoForm.support_card==1" ref="card_effective_days" label="有效期" prop="card_effective_days">
                  <el-input :disabled="isSelled" :maxlength="4" v-model.number="infoForm.card_effective_days"
                    style="width:100px;"></el-input><span class="info_remark">{{effect_text}}</span>
                </el-form-item>
              </el-col>
            </el-form-item>
            <div v-show="basicForm.second_type==3" class="op_title">续期（选填）</div>
            <el-form-item v-show="basicForm.second_type==3" label-width="0" prop="support_renewal">
              <div class="op_col w">
                <el-checkbox :disabled="isSelled" true-label="1" false-label="0" class="op_checked" @change="opCheckedChange(infoForm.support_renewal,3)"
                  label="支持续期" v-model="infoForm.support_renewal"></el-checkbox>
                <div v-show="infoForm.support_renewal==1" class="op_item op_renewal">
                  <div>有效期延长</div>
                  <el-form-item style="margin-left:10px" ref="add_renewal_days" prop="add_renewal_days">
                    <el-input :disabled="isSelled" :maxlength="6" v-model.number="infoForm.add_renewal_days" style="width:100px;margin-right:10px"></el-input>
                    <span v-show="infoForm.support_renewal==1">天</span>
                  </el-form-item>
                  <div class="op_remark">{{effect_text}}</div>
                </div>
              </div>
            </el-form-item>
            <div v-show="basicForm.second_type==5" class="op_title">预约（选填）</div>
            <el-form-item v-show="basicForm.second_type==5" label-width="0" prop="support_reserve">
              <el-checkbox :disabled="isSelled" true-label="1" false-label="0" label="需要预约" v-model="infoForm.support_reserve"></el-checkbox>
            </el-form-item>
            <div v-show="basicForm.second_type==6" class="op_title">到店（选填）</div>
            <el-form-item v-show="basicForm.second_type==6" label-width="0" prop="support_store">
              <el-checkbox :disabled="isSelled" true-label="1" false-label="0" label="到店使用" v-model="infoForm.support_store"></el-checkbox>
              <span v-show="infoForm.support_store==1" class="info_remark">勾选后表示用户需到店才能使用，到店是指小程序定位3公里内扫门店自助设备二维码</span>
            </el-form-item>
            <div v-show="basicForm.second_type!=8" class="op_title">用券（选填）</div>
            <el-form-item v-show="basicForm.second_type!=8" label-width="0" prop="support_coupons">
              <el-checkbox :disabled="isSelled" true-label="1" false-label="0" label="支持用券" v-model="infoForm.support_coupons"></el-checkbox>
              <span v-show="infoForm.support_coupons==1" class="info_remark">具体哪些券可用于该套餐，请到券管理页面配置</span>
            </el-form-item>
            <div class="op_title">标签（选填）</div>
            <el-form-item label-width="0" prop="tab">
              <el-checkbox-group v-model="infoForm.tab">
                <el-checkbox :disabled="basicForm.second_type==8" v-for="item in tab_list" :label="item.id" :key="item.id">{{item.name}}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <div class="op_title">角标（选填）</div>
            <el-form-item label-width="0" prop="corner_mark">
              <el-radio-group v-model="infoForm.corner_mark">
                <el-radio :disabled="basicForm.second_type==8" @click.native.prevent="cornerClick(item.id)" v-for="item in corner_list" :label="item.id" :key="item.id">{{item.name}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <div v-show="tab_step==2" class="info goods">
        <el-radio :disabled="isNew==3||isDisabled||isSelled" @change="storeRadioChange" v-model="storeRadio" label="0">全门店</el-radio>
        <el-radio :disabled="isNew==3||isDisabled||isSelled" @change="storeRadioChange" v-model="storeRadio" label="2">指定门店</el-radio>
        <div v-show="storeRadio==0" class="store_info">
          <span v-show="storeRadio==='0'">全门店表示支持所有营业中的门店进行销售</span>
        </div>
        <div v-show="storeRadio==='2'" class="store_choose">
          <div>
            <div class="transferHeader">选择门店</div>
            <div class="transferHeader">已选门店</div>
          </div>
          <dj-transfer :data='choose_store_list' v-model="check_store_list" :disabled="isDisabled"></dj-transfer>
        </div>
      </div>
      <div v-show="tab_step==3">
        <el-form :disabled="isNew==3||isDisabled||isSelled" :model="timeForm" ref="timeForm" :rules="rules">
          <div class="info goods">
            <el-radio :disabled="isDisabled||isSelled" @change="timeRadioChange" v-model="timeRadio" label="1">有效期</el-radio>
            <el-radio :disabled="isDisabled||isSelled" @change="timeRadioChange" v-model="timeRadio" label="2">有效时长</el-radio>
            <div class="time_info">
              <el-form-item style="margin-bottom:10px" v-show="timeRadio==1" prop="pickerTime">
                <div>
                  <el-date-picker style="width:240px;margin-right:10px" v-model="timeForm.pickerTime" value-format="yyyy-MM-dd" type="daterange" align="right"
                    unlink-panels range-separator="-" :clearable="false" size="small" start-placeholder="开始日期" end-placeholder="结束日期"
                    :picker-options="pickerTimeForm"></el-date-picker>
                  期间可使用
                </div>
                <div class="remark">可用时间为有效期开始日期的 00:00:00到截止日期的 23:59:59</div>
              </el-form-item>
              <el-form-item style="margin-bottom:10px" v-show="timeRadio==2">
                <div class="intime">
                  用户购买后
                  <el-form-item class="intime_item" prop="intime" ref="intimeForm">
                    <el-input style="width:140px" size="small" :maxlength="4" v-model.number="timeForm.intime"></el-input>
                  </el-form-item>
                  天内有效
                </div>
                <div class="remark">可用时间为购买当天到最后一天的23:59:59，如果设置为0天内有效，即表示仅限购买当天使用</div>
              </el-form-item>
            </div>
          </div>
          <div class="info goods">
            <el-form-item prop="week" class="time_title">
              <el-checkbox @change="weekChange" label="设置可用日期" v-model="timeForm.week"></el-checkbox>
            </el-form-item>
            <el-form-item class="time_info time_item" v-show="timeForm.week" prop="week_day" ref="weekDayForm">
              <el-checkbox-group v-model="timeForm.week_day">
                <el-checkbox v-for="item in weeks" :label="item.id" :key="item.id">{{item.name}}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item prop="dis_day" class="time_title">
              <el-checkbox @change="disDayChange" label="设置不可用日期" v-model="timeForm.dis_day"></el-checkbox>
              <el-button @click="editDisDayClick" v-show="timeForm.dis_day&&!isDisabled&&!isSelled" style="margin-left:30px" type="text"><i
                  class="el-icon-date"></i> 编辑日期</el-button>
              <div v-show="timeForm.dis_day" class="time_info time_item">
                <div v-show="timeForm.disable_date" class="dis_day_text">{{timeForm.disable_date}} 期间不可用</div>
                <div class="remark">不可用是指所有选中日期的全天都不可用，即00:00:00-23:59:59</div>
              </div>
            </el-form-item>
            <el-form-item prop="time" class="time_title">
              <el-checkbox @change="timeChange" label="设置可用时间" v-model="timeForm.time"></el-checkbox>
            </el-form-item>
            <el-form-item class="time_info time_item" v-show="timeForm.time" prop="clock_time">
              <el-time-picker size="small" style="width:240px" is-range :clearable="false" v-model="timeForm.clock_time" value-format="HH:mm:ss"
                range-separator="-">
              </el-time-picker>
              <div class="remark" style="margin-bottom:10px">指一天内可使用该券的时间范围，00:00:00-23:59:59</div>
            </el-form-item>
          </div>
          <div v-show="basicForm.second_type==7" class="info goods">
            <div class="time_item" style="margin-bottom:20px">到店使用：<span style="color:#606266">需前往门店收银台核销</span></div>
          </div>
        </el-form>
      </div>
      <div style="text-align:right;margin-bottom:20px">
        <el-button v-show="tab_step>1&&isNew==1" @click="tab_step--" plain size="small">上一步</el-button>
        <el-button v-show="tab_step<step_list.length&&isNew==1" @click="goNext" type="primary" size="small">下一步</el-button>
        <el-button v-show="tab_step==step_list.length&&isNew==1" @click="saveClick" type="primary" size="small">保存</el-button>
        <el-button v-show="isDisabled&&isNew==2&&(!isSelled||(isSelled&&tab_step<3))" @click="editClick(3)" type="primary" size="small">修改</el-button>
        <el-button v-show="!isDisabled&&isNew==2" @click="editClick(1)" plain size="small">取消</el-button>
        <el-button v-show="!isDisabled&&isNew==2" @click="editClick(2)" type="primary" size="small">保存</el-button>
      </div>
    </div>
    <!-- 弹框 -->
    <el-dialog :close-on-click-modal="false" title="选择商品类型" :visible.sync="addTypeDialog" width="300px">
      <div class="add_type">
        <div v-for="item of add_type_list" :key="item.id" @click="addClick(item.id,item.name)" class="add_type_info">{{item.name}}</div>
      </div>
    </el-dialog>
    <!-- 不可用日期弹框 -->
    <el-dialog :close-on-click-modal="false" title="编辑不可用日期" :visible.sync="disDayDialog" width="400px">
      <div class="dis_day_btn">
        <el-date-picker value-format="yyyy-MM-dd" size="small" v-model="current_dis_day" style="width:140px;margin-right:10px" type="date" placeholder="请选择日期">
        </el-date-picker>
        <el-button @click="addDisDayClick" type="primary" size="small">添加</el-button>
      </div>
      <div class="check_meal dis_day">
        <div class="check_meal_list">
          <div class="check_meal_item" v-for="(day,i) of dis_day_list" :key="i">
            <span>{{day}}</span><span class='el-icon-close' @click="delDisDay(i)"></span>
          </div>
        </div>
      </div>
      <el-button @click="clearAllDisDay" type="text" size="small">清空全部日期</el-button>
      <el-button class="pull-right mt10" :disabled="dis_day_list.length==0" @click="confirmDisDay" type="primary" size="small">确认</el-button>
    </el-dialog>
    <!-- 自定义底部 -->
    <div v-show="tab_view==1" class="bottom_box">
      <el-pagination class="pull-left" background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="20"
        layout="prev, pager, next, jumper" :total="totalDataNumber">
      </el-pagination>
    </div>
  </div>
</template>
<script>
import {
  getPage,
  getList,
  getStore,
  getCardList,
  goodsCreate,
  goodsInfo,
  goodsUpdate
} from "@/api/operation/goodsManagement";
import {
  pickerOptionsF,
  pickerDateOneMonth,
  pickerOptionsGtDay,
  pickerDateDot,
  optionMaxTime,
  getGoodsType
} from "@/utils";
import {
  commonCharName,
  money0tox,
  integer1to999,
  integer1to999999,
  integer0to999999,
  integer1tox
} from "@/utils/validate";
import { djTransfer } from "@/components/transfer";
import { djTab } from "@/components/tab";
export default {
  components: {
    "dj-transfer": djTransfer,
    "dj-tab": djTab
  },
  data() {
    const vName = (rule, value, callback) => {
      if (this.isNew != 3) {
        if (value.length<2) {
          callback(new Error("请输入2-20位字符"));
        } else {
          if (!commonCharName(value)) {
            callback(new Error("名称不能包含特殊字符"));
          } else {
            callback();
          }
        }
      } else {
        callback();
      }
    };
    const vDes = (rule, value, callback) => {
      if (this.isNew != 3 && !value) {
        callback(new Error("请输入说明"));
      } else {
        callback();
      }
    };
    const vCardType = (rule, value, callback) => {
      if (this.isNew != 3 && this.basicForm.second_type == 2 && !value) {
        callback(new Error("请选择卡类型"));
      } else {
        callback();
      }
    };
    const vMoreCardType = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        this.basicForm.second_type != 2 &&
        this.basicForm.second_type != 5 &&
        this.basicForm.second_type < 7 &&
        value.length == 0
      ) {
        callback(new Error("请选择卡类型"));
      } else {
        callback();
      }
    };
    const vMoney0 = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type < 4 ||
          this.basicForm.second_type == 5 ||
          ((this.basicForm.second_type == 4 ||
            this.basicForm.second_type == 6 ||
            this.basicForm.second_type == 7) &&
            this.infoForm.support_buy === "1"))
      ) {
        if (value === "") {
          callback(new Error("请输入金额"));
        } else {
          if (money0tox(value, 6)) {
            callback();
          } else {
            callback(new Error("金额只能为0-999999之间，保留2位小数"));
          }
        }
      } else {
        callback();
      }
    };
    const vMoney1 = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        this.basicForm.second_type == 5 &&
        this.infoForm.support_accompany_buy === "1"
      ) {
        if (value === "") {
          callback(new Error("请输入金额"));
        } else {
          if (money0tox(value, 4)) {
            callback();
          } else {
            callback(new Error("金额只能为0-9999之间，保留2位小数"));
          }
        }
      } else {
        callback();
      }
    };
    const vCoins1 = (rule, value, callback) => {
      if (
        this.isNew != 3 &&this.choose_card_type == 0&&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!=''))
      ) {
        if (value === "") {
          callback(new Error(`请输入币数`));
        } else {
          if (integer0to999999(value) && value / 1 >= this.initial_balance) {
            callback();
          } else {
            callback(
              new Error(`币数只能为${this.initial_balance}-999999之间的整数`)
            );
          }
        }
      } else {
        callback();
      }
    };
    const vTimes = (rule, value, callback) => {
      if (
        this.isNew != 3 &&this.choose_card_type == 1&&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!=''))
      ) {
        if (value === "") {
          callback(new Error(`请输入次数`));
        } else {
          if (integer0to999999(value) && value / 1 >= this.initial_balance) {
            callback();
          } else {
            callback(
              new Error(`次数只能为${this.initial_balance}-999999之间的整数`)
            );
          }
        }
      } else {
        callback();
      }
    };
    const vTimes_giving = (rule, value, callback) => {
      if (
        this.isNew != 3 &&this.choose_card_type == 1&&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!=''))
      ) {
        if (value === "") {
          callback();
        } else {
          if (integer0to999999(value) && value / 1 >= this.initial_balance) {
            callback();
          } else {
            callback(
              new Error(`次数只能为${this.initial_balance}-999999之间的整数`)
            );
          }
        }
      } else {
        callback();
      }
    };
    const vStar = (rule, value, callback) => {
      if (
        this.isNew != 3 &&this.choose_card_type == 2&&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!=''))
      ) {
        if (value === "") {
          callback(new Error(`请输入星数`));
        } else {
          if (integer0to999999(value) && value / 1 >= this.initial_balance) {
            callback();
          } else {
            callback(
              new Error(`星数只能为${this.initial_balance}-999999之间的整数`)
            );
          }
        }
      } else {
        callback();
      }
    };
    const vStar_giving = (rule, value, callback) => {
      if (
        this.isNew != 3 &&this.choose_card_type == 2&&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!=''))
      ) {
        if (value === "") {
          callback();
        } else {
          if (integer0to999999(value) && value / 1 >= this.initial_balance) {
            callback();
          } else {
            callback(
              new Error(`星数只能为${this.initial_balance}-999999之间的整数`)
            );
          }
        }
      } else {
        callback();
      }
    };
    const vCoins2 = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!='')) &&
        this.choose_card_type == 0
      ) {
        if (value === "") {
          callback(new Error("请输入币数"));
        } else {
          if (integer0to999999(value)) {
            callback();
          } else {
            callback(new Error("币数只能为0-999999之间"));
          }
        }
      } else {
        callback();
      }
    };
    const vPri = (rule, value, callback) => {
      if (this.isNew != 3) {
        if (value === "") {
          callback(new Error("请输入优先级"));
        } else {
          if (integer1to999(value)) {
            callback();
          } else {
            callback(new Error("优先级只能为1-999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vTime = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type == 2 ||
          (this.basicForm.second_type == 3 &&
            this.infoForm.support_renewal == 1) ||
          this.basicForm.second_type == 4)
      ) {
        if (value === "") {
          callback(new Error("请输入有效期"));
        } else {
          if (this.basicForm.second_type == 2) {
            if (integer0to999999(value) && value < 3651) {
              callback();
            } else {
              callback(new Error("有效期只能为0-3650之间的整数"));
            }
          } else {
            if (integer0to999999(value) && value < 3651 && value > 0) {
              callback();
            } else {
              callback(new Error("有效期只能为1-3650之间的整数"));
            }
          }
        }
      } else {
        callback();
      }
    };
    const vSCDays = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type < 4 || this.basicForm.second_type == 6 || (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id!='')) &&
        this.choose_card_type == 0
      ) {
        if (value === "") {
          callback(new Error("请输入有效期"));
        } else {
          if (integer0to999999(value) && value < 3651) {
            callback();
          } else {
            callback(new Error("有效期只能为0-3650之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vDays = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        this.basicForm.second_type == 3 &&
          this.infoForm.support_card==1
      ) {
        if (value === "") {
          callback(new Error("请输入有效期"));
        } else {
          if (integer0to999999(value) && value < 3651) {
            callback();
          } else {
            callback(new Error("有效期只能为0-3650之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vScore = (rule, value, callback) => {
      if (this.isNew != 3 && this.add_score_type) {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (integer1to999999(value)) {
            callback();
          } else {
            callback(new Error("数量只能为1-999999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vTicket = (rule, value, callback) => {
      if (this.isNew != 3 && this.add_ticket_type) {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (integer1to999999(value)) {
            callback();
          } else {
            callback(new Error("数量只能为1-999999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vPscore = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type == 4 || this.basicForm.second_type >= 6) &&
        this.infoForm.support_score === "1"
      ) {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (integer0to999999(value)) {
            callback();
          } else {
            callback(new Error("数量只能为0-999999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vPticket = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        this.basicForm.second_type >= 6 &&
        this.infoForm.support_ticket === "1"
      ) {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (integer0to999999(value)) {
            callback();
          } else {
            callback(new Error("数量只能为0-999999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vVName = (rule, value, callback) => {
      if (this.isNew != 3 && this.pay_voucher === "1") {
        if (value.length<2) {
          callback(new Error("请输入2-20位字符"));
        } else {
          if (!commonCharName(value)) {
            callback(new Error("名称不能包含特殊字符"));
          } else {
            callback();
          }
        }
      } else {
        callback();
      }
    };
    const vRtype = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        this.basicForm.second_type == 4 &&
        this.infoForm.support_buy == 0 &&
        this.infoForm.support_score == 0
      ) {
        callback(new Error("请选择续期方式"));
      } else {
        callback();
      }
    };
    const vVoucher = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type == 6 || this.basicForm.second_type == 7) &&
        this.infoForm.support_buy == 0 &&
        this.infoForm.support_score == 0 &&
        this.infoForm.support_ticket == 0 &&
        this.pay_voucher == 0
      ) {
        callback(new Error("请选择获得方式"));
      } else {
        callback();
      }
    };
    const vGet = (rule, value, callback) => {
      if (
        this.isNew != 3 &&
        (this.basicForm.second_type == 8 && this.basicForm.more_card_type_id=='' ) &&
        !this.add_score_type &&
        !this.add_ticket_type
      ) {
        // callback(new Error("请选择账户获得"));
        callback();
      } else {
        callback();
      }
    };
    const vVNum = (rule, value, callback) => {
      if (this.isNew != 3 && this.pay_voucher === "1") {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (integer1tox(value, 4)) {
            callback();
          } else {
            callback(new Error("数量只能为1-9999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vIntime = (rule, value, callback) => {
      if (this.isNew != 3 && this.timeRadio == 2) {
        if (value === "") {
          callback(new Error("请输入有效时长"));
        } else {
          if (integer0to999999(value) && value < 3651) {
            callback();
          } else {
            callback(new Error("只能为0-3650之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    const vWeekDay = (rule, value, callback) => {
      if (this.isNew != 3 && this.timeForm.week) {
        if (value.length === 0) {
          callback(new Error("请选择可用日期"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    const vAtickes = (rule, value, callback) => {
      if (this.isNew != 3 && this.basicForm.second_type == 5) {
        if (value === "") {
          callback(new Error("请输入数量"));
        } else {
          if (value == 0 || integer1tox(value, 4)) {
            callback();
          } else {
            callback(new Error("数量只能为0-9999之间的整数"));
          }
        }
      } else {
        callback();
      }
    };
    // const vAitem = (rule, value, callback) => {
    //   if (this.isNew != 3 && this.basicForm.second_type == 7) {
    //     if (value.length<2) {
    //       callback(new Error("请输入2-20位字符"));
    //     } else {
    //       if (!commonCharName(value)) {
    //         callback(new Error("名称不能包含特殊字符"));
    //       } else {
    //         callback();
    //       }
    //     }
    //   } else {
    //     callback();
    //   }
    // };
    // const vAitemNum = (rule, value, callback) => {
    //   if (this.isNew != 3 && this.basicForm.second_type == 7) {
    //     if (value === "") {
    //       callback(new Error("请输入数量"));
    //     } else {
    //       if (integer1tox(value, 6)) {
    //         callback();
    //       } else {
    //         callback(new Error("数量只能为1-999999之间的整数"));
    //       }
    //     }
    //   } else {
    //     callback();
    //   }
    // };
    return {
      list: null,
      listLoading: false,
      addTypeDialog: false,
      disDayDialog: false,
      isNew: 1, //1 新增 2 修改 3 详情
      isDisabled: false, //是否可修改
      isSelled: false, //销售过的部分数据不可修改
      tab_view: 1,
      tab_step: 1,
      top_title: "",
      currentPage: 1,
      totalDataNumber: 0,
      store_list: [],
      choose_store_list: [], //弹窗中的门店
      status: ["1", "2", "3"],
      type: ["2", "3", "4", "5", "6", "7", "8"],
      type_list: [
        { id: "2", name: "办卡" },
        { id: "3", name: "充值" },
        { id: "4", name: "续期" },
        { id: "5", name: "门票" },
        { id: "6", name: "企划" },
        { id: "7", name: "实物" },
        { id: "8", name: "凭证兑换" },
      ],
      tab_list: [{ id: "1", name: "特价销售" }],
      corner_list: [
        //角标
        { id: "1", name: "店长推荐" },
        { id: "2", name: "精选热卖" },
        { id: "3", name: "限时特卖" },
        { id: "4", name: "会员专享" },
        { id: "5", name: "签到福利" },
        { id: "6", name: "生日福利" },
        { id: "7", name: "分享有礼" },
        { id: "8", name: "办卡福利" },
        // { id: "9", name: "新人专享" },
        // { id: "10", name: "限时免费" },
      ],
      status_list: [
        { id: "1", name: "待设置" },
        { id: "2", name: "未开售" },
        { id: "3", name: "销售中" },
        { id: "4", name: "已停售" }
      ],
      add_type_list: [
        { id: "2", name: "办卡" },
        { id: "3", name: "充值" },
        { id: "4", name: "续期" },
        { id: "5", name: "门票" },
        { id: "6", name: "企划" },
        { id: "7", name: "实物" },
        { id: "8", name: "凭证兑换" },
      ],
      step_list: ["1. 基础信息", "2. 使用门店"],
      all_card_type: [], //未分组卡类型
      pay_card_type: [], //充值卡类型
      card_type_list: [], //其他的卡类型
      choose_card_type: 0, // 当前选择的卡类型 0 币  1 次  2 星星
      initial_balance: 0, // 当前选择的卡的初始余额
      isCancel: false, // 余额为0是否自动注销
      isLimit: true, // 有效期内是否有使用限制
      effect_text: "", //卡类型有效期提醒文字
      add_score_type: false, // 是否赠送积分
      add_ticket_type: false, // 是否赠送彩票
      supCardDisabled: false, // 是否禁用办卡
      pay_voucher: "0", // 是否需要凭证
      formInline: {
        begin_time: "",
        end_time: "",
        store_id: "",
        type: [],
        status: [],
        name: "",
        sort_by: "desc"
      },
      basicForm: {
        type: "",
        second_type: "",
        card_type_id: "",
        more_card_type_id: [], //卡类型多选
        name: "",
        describe: ""
      },
      infoForm: {
        add_renewal_days: "",
        support_buy: "0", // 是否缴费续期
        pay_money: "",
        support_score: "0", // 是否积分续期
        pay_score: "",
        add_coins: "",
        add_times: "",
        add_giving_times:"",
        add_star: "",
        add_giving_stars:"",
        add_giving_coins: "",
        add_special_coins: "",
        add_special_coins_days: "",
        add_adult_tickets: "1",
        add_child_tickets: "1",
        support_accompany_buy: "0",
        pay_accompany_money: "",
        add_score: "",
        add_ticket: "",
        support_reserve: "0",
        support_coupons: "0",
        support_store: "0",
        tab: [],
        corner_mark: "",
        priority: "100",
        support_card: "0",
        support_renewal: "0",
        support_ticket: "0",
        card_effective_days: "",
        pay_ticket: "",
        pay_voucher_name: "",
        pay_voucher_num: "",
        add_item: "",
        add_item_num: ""
      },
      timeRadio: "1", //1有效期 2有效时长
      weeks: [
        { id: "1", name: "周一" },
        { id: "2", name: "周二" },
        { id: "3", name: "周三" },
        { id: "4", name: "周四" },
        { id: "5", name: "周五" },
        { id: "6", name: "周六" },
        { id: "0", name: "周日" }
      ],
      timeForm: {
        //使用限制
        pickerTime: pickerDateDot(),
        intime: "",
        week: "",
        week_day: [],
        time: "",
        dis_day: "",
        clock_time: ["00:00:00", "23:59:59"], //可用时间
        disable_date: "" //禁用日期
      },
      dis_day_list: [], //禁用日期列表
      current_dis_day: "", //当前选择的日期
      id: "", //查看的商品id
      update_time: "", //商品更新时间
      storeRadio: "0", //0全门店 2指定门店
      check_store_list: [], //已选择门店
      oldBasicData: {}, //修改前的数据
      oldInfoData: {},
      oldStoreData: {},
      oldTypeData: {},
      oldTimeData: {},
      pickerOptions: pickerOptionsF(),
      pickerDate: pickerDateOneMonth(),
      pickerTimeForm: pickerOptionsGtDay(),
      rules: {
        name: [{ required: false, validator: vName, trigger: "blur" }],
        describe: [{ required: false, validator: vDes, trigger: "blur" }],
        card_type_id: [
          { required: false, validator: vCardType, trigger: "change" }
        ],
        more_card_type_id: [
          { required: false, validator: vMoreCardType, trigger: "change" }
        ],
        add_renewal_days: [
          { required: false, validator: vTime, trigger: "blur" }
        ],
        pay_money: [{ required: false, validator: vMoney0, trigger: "blur" }],
        add_coins: [{ required: false, validator: vCoins1, trigger: "blur" }],
        add_times: [{ required: false, validator: vTimes, trigger: "blur" }],
        add_giving_times: [{validator: vTimes_giving,trigger: "blur"}],
        add_star: [{ required: false, validator: vStar, trigger: "blur" }],
        add_giving_stars: [{validator: vStar_giving,trigger: "blur"}],
        add_giving_coins: [
          { required: false, validator: vCoins2, trigger: "blur" }
        ],
        add_special_coins: [
          { required: false, validator: vCoins2, trigger: "blur" }
        ],
        add_special_coins_days: [
          { required: false, validator: vSCDays, trigger: "blur" }
        ],
        priority: [{ required: false, validator: vPri, trigger: "blur" }],
        add_get: [{ required: false, validator: vGet, trigger: "blur" }],
        add_score: [{ required: false, validator: vScore, trigger: "blur" }],
        add_ticket: [{ required: false, validator: vTicket, trigger: "blur" }],
        pay_score: [{ required: false, validator: vPscore, trigger: "blur" }],
        pay_ticket: [{ required: false, validator: vPticket, trigger: "blur" }],
        renewal_type: [{ required: false, validator: vRtype, trigger: "blur" }],
        pay_voucher_name: [
          { required: false, validator: vVName, trigger: "blur" }
        ],
        pay_voucher_num: [
          { required: false, validator: vVNum, trigger: "blur" }
        ],
        voucher: [{ required: false, validator: vVoucher, trigger: "blur" }],
        intime: [{ required: false, validator: vIntime, trigger: "blur" }],
        card_effective_days: [{ required: false, validator: vDays, trigger: "blur" }],
        week_day: [{ required: false, validator: vWeekDay, trigger: "change" }],
        add_adult_tickets: [
          { required: false, validator: vAtickes, trigger: "blur" }
        ],
        add_child_tickets: [
          { required: false, validator: vAtickes, trigger: "blur" }
        ],
        pay_accompany_money: [
          { required: false, validator: vMoney1, trigger: "blur" }
        ],
        add_item: [{ required: false, message: "", trigger: "blur" }],
        // add_item_num: [
        //   { required: false, validator: vAitemNum, trigger: "blur" }
        // ]
      }
    };
  },
  created() {
    this.getstore();
  },
  methods: {
    getstore() {
      getStore({ category_id: 678 }).then(response => {
        if (response.length > 1) {
          response.unshift({ id: "0", name: "全部" });
        }
        this.store_list = response;
        let data = response.filter(
          res => res.id == this.$store.getters.optionId
        );
        if (data.length > 0) {
          this.formInline.store_id = data[0].id;
        }
        this.searchClick();
      });
    },
    getChooseStore() {
      getStore({ category_id: 678, s_status: 2 }).then(res => {
        let list = [];
        res.forEach(val => {
          list.push({ id: val.id, name: val.name, disabled: false });
        });
        this.choose_store_list = list;
      });
    },
    //获取卡类型
    getCardType(ids) {
      getCardList({}).then(res => {
        if (res.code == 1) {
          let data = res.data;
          this.all_card_type = JSON.parse(JSON.stringify(data));
          this.card_type_list = this.cardTypeGroup(data);
          this.pay_card_type = this.cardTypeGroup(
            data.filter(item => item.is_limit != 0)
          );
          ids && this.getEffEctText(ids);
        }
      });
    },
    // 卡类型分组
    cardTypeGroup(data) {
      let map = {};
      data.forEach(i => {
        if (!map[i.type]) {
          map[i.type] = {
            type: i.type,
            type_name:
              i.type == 0
                ? "币"
                : i.type == 1
                ? "次"
                : i.type == 2
                ? "星星"
                : "",
            list: [{ id: i.id, name: i.name, disabled: false }]
          };
        } else {
          map[i.type].list.push({
            id: i.id,
            name: i.name,
            disabled: false
          });
        }
      });
      let list = [];
      for (var i in map) {
        list.push(map[i]);
      }
      return list;
    },
    // 搜索
    searchClick() {
      optionMaxTime(this.pickerDate).then(() => {
        //最大可选择时间区间
        if (this.status.length == 0) {
          this.$message.error("请至少选择一种状态");
          return;
        }
        this.formInline.begin_time = this.pickerDate ? this.pickerDate[0] : "";
        this.formInline.end_time = this.pickerDate ? this.pickerDate[1] : "";
        this.formInline.status = this.status;
        this.formInline.second_type = this.type;
        this.fetchData();
      });
    },
    goSale(i, id) {
      this.$router.push({
        name: "operation/sales_management",
        params: { id, isNew: i, routerflag: 2 }
      });
    },
    // 更新时间排序
    tableSort({ column, prop, order }) {
      this.formInline.sort_by = order === "descending" ? "desc" : "asc";
      this.searchClick();
    },
    getData(data) {
      data.forEach(val => {
        val.type_name = getGoodsType(val.second_type);
      });
      this.list = data;
    },
    // 列表获取
    fetchData() {
      this.listLoading = true;
      this.list = [];
      getPage(this.formInline)
        .then(response => {
          this.totalDataNumber = response.data.count / 1;
          if (this.totalDataNumber == 0) {
            this.listLoading = false;
          } else {
            getList(this.formInline)
              .then(res => {
                this.listLoading = false;
                this.getData(res.data);
              })
              .catch(res => {
                this.listLoading = false;
              });
          }
        })
        .catch(res => {
          this.listLoading = false;
        });
    },
    handleCurrentChange(val) {
      getList(this.formInline, val)
        .then(res => {
          this.listLoading = false;
          this.getData(res.data);
        })
        .catch(res => {
          this.listLoading = false;
        });
    },
    // 新增商品选择弹窗
    addTypeClick() {
      this.addTypeDialog = true;
      this.getCardType();
    },
    backClick() {
      if (this.isNew < 3 && !this.isDisabled) {
        this.$confirm(
          "返回后已修改的数据不会保存，是否放弃本次操作？",
          "提示",
          { type: "warning" }
        ).then(() => {
          this.goBack();
        });
      } else {
        this.goBack();
      }
    },
    goBack() {
      this.$refs.basicForm.resetFields();
      this.$refs.infoForm.resetFields();
      this.$refs.timeForm.resetFields();
      this.isSelled = false;
      this.add_score_type = false;
      this.add_ticket_type = false;
      this.supCardDisabled = false;
      this.check_store_list = [];
      this.choose_store_list.forEach(val => (val.disabled = false));
      this.infoForm.support_buy = "0";
      this.infoForm.support_score = "0";
      this.infoForm.support_ticket = "0";
      this.infoForm.add_item = "";
      this.infoForm.add_item_num = 0;
      this.pay_voucher = "0";
      this.storeRadio = "0";
      this.timeRadio = "1";
      this.timeForm.disable_date = "";
      this.effect_text = "";
      this.choose_card_type = 0;
      this.tab_view = 1;
      this.id = "";
      this.update_time = "";
      this.searchClick();
    },
    addClick(id, name) {
      if (id < 2 || id > 8) {
        this.$message.info("暂不支持");
      } else {
        switch (id / 1) {
          case 5:
            this.basicForm.type = 3;
            break;
          case 7:
            this.basicForm.type = 2;
            break;
          default:
            this.basicForm.type = 1;
            break;
        }
        this.getChooseStore();
        this.basicForm.second_type = id;
        this.step_list =
          id < 5||id==8
            ? ["1. 基础信息", "2. 使用门店"]
            : ["1. 基础信息", "2. 使用门店", "3. 使用限制"];
        this.addTypeDialog = false;
        this.isDisabled = false;
        this.top_title = `新增${name}套餐`;
        this.isNew = 1;
        this.tab_view = 2;
        this.tab_step = 1;
      }
    },
    // i 3详情  2修改
    infoClick(i, goods_id, second_type) {
      this.getChooseStore();
      this.isNew = i;
      let type_name = getGoodsType(second_type);
      this.top_title = i == 2 ? `修改${type_name}套餐` : `${type_name}套餐详情`;
      this.basicForm.second_type = second_type;
      this.step_list =
        second_type < 5||second_type==8
          ? ["1. 基础信息", "2. 使用门店"]
          : ["1. 基础信息", "2. 使用门店", "3. 使用限制"];
      this.tab_view = 2;
      this.tab_step = 1;
      this.isDisabled = true;
      goodsInfo({ goods_id }).then(res => {
        if (res.code == 1) {
          let data = res.data;
          this.id = data.id;
          this.choose_card_type = second_type==8&&!data.card_type ? 0 : data.card_type;
          //是否销售过
          this.isSelled = data.is_selled == 1;
          // 1
          this.basicForm.name = data.name;
          this.basicForm.describe = data.describe;
          this.basicForm.type = data.type;
          this.basicForm.card_type_id =
            data.second_type == 2 ? data.card_type_id : "";
          this.basicForm.more_card_type_id =
            data.second_type > 2&&data.second_type != 8 ? data.card_type_id.split(",") : [];

          data.pay_money =data.support_buy == 0?"": (data.pay_money / 100).toFixed(2);
          data.pay_accompany_money =data.pay_accompany_money?(data.pay_accompany_money / 100).toFixed(2): "";
          data.add_score =
            data.add_score && data.add_score / 1 ? data.add_score : "";
          data.add_ticket =
            data.add_ticket && data.add_ticket / 1 ? data.add_ticket : "";
          data.add_renewal_days =
            data.add_renewal_days / 1 ? data.add_renewal_days : "";
          data.pay_score = data.support_score == 0 ? "" : data.pay_score;
          data.add_renewal_days =
            data.add_renewal_days == 0 ? "" : data.add_renewal_days;
          data.tab = data.tab === "0" ? [] : data.tab.split(",");
          for (let infoKey in this.infoForm) {
            for (let dataKey in data) {
              if (dataKey == infoKey) {
                this.infoForm[infoKey] = data[infoKey];
                break;
              }
            }
          }
          this.update_time = data.update_time;
          this.add_score_type = this.infoForm.add_score != "";
          this.add_ticket_type = this.infoForm.add_ticket != "";
          this.pay_voucher = data.pay_voucher_name ? "1" : "0";
          this.effect_text = "";
          this.oldBasicData = JSON.stringify(this.basicForm);
          this.oldInfoData = JSON.stringify(this.infoForm);
          this.oldTypeData = {
            add_score_type: this.add_score_type,
            add_ticket_type: this.add_ticket_type
          };
          // 2
          this.storeRadio = data.chose_store_type;
          data.store_list &&
            data.store_list.forEach(val => {
              this.check_store_list.push(val.store_id);
            });
          this.oldStoreData = {
            storeRadio: data.chose_store_type,
            check_store_list: JSON.stringify(this.check_store_list)
          };
          this.getCardType(
            data.second_type == 2
              ? this.basicForm.card_type_id
              : this.basicForm.more_card_type_id
          );
          // 3
          this.timeRadio = data.chose_time_type;
          this.timeForm.pickerTime =
            this.timeRadio == 1
              ? data.effect_time.split(",")
              : this.timeForm.pickerTime;
          this.timeForm.intime = this.timeRadio == 1 ? "" : data.effect_time;
          this.timeForm.week = !data.week_day == "";
          this.timeForm.week_day = data.week_day
            ? data.week_day.split(",")
            : [];
          this.timeForm.time = !data.clock_time == "";
          this.timeForm.clock_time = data.clock_time
            ? data.clock_time.split(",")
            : this.timeForm.clock_time;
          this.timeForm.dis_day = !data.disable_date == "";
          this.timeForm.disable_date = this.timeForm.dis_day
            ? data.disable_date.replace(/,/g, "，")
            : "";
          this.oldTimeData = JSON.stringify(this.timeForm);
        }
      });
    },
    verify() {
      if (this.tab_view == 1) {
        return;
      }
      let isPass = false;
      if (this.tab_step == 1) {
        this.$refs.basicForm.validate(valid => {
          this.$refs.infoForm.validate(val => {
            isPass = val && valid;
          });
        });
      } else if (this.tab_step == 2) {
        if (this.storeRadio !== "0" && this.check_store_list.length == 0) {
          this.$message.error("请选择使用门店");
          isPass = false;
        } else {
          isPass = true;
        }
      } else if (this.tab_step == 3) {
        this.$refs.timeForm.validate(valid => {
          if (this.timeForm.dis_day && !this.timeForm.disable_date) {
            this.$message.error("请选择禁用日期");
            isPass = false;
          } else {
            isPass = valid;
          }
        });
      }
      return isPass;
    },
    goNext() {
      if((this.basicForm.second_type>=6&&this.basicForm.second_type!=8)&& (this.infoForm.support_buy == 0 && this.infoForm.support_score == 0 && this.infoForm.support_ticket == 0)){
        this.$message.error("获得方式至少勾选一项");
        return;
      }
      if (!this.verify()) {
        return;
      }
      this.tab_step++;
    },
    goStep(i) {
      if (this.isNew == 1) {
        return;
      }
      if (!this.isDisabled) {
        this.$confirm(
          "该页面尚未保存，是否要切换页面？切换后修改后的数据不会保存",
          "提示",
          { type: "warning" }
        ).then(() => {
          this.isDisabled = true;
          this.tab_step = i;
        });
      } else {
        this.tab_step = i;
      }
    },
    getEffEctText(val) {
      if (this.basicForm.second_type == 2) {
        let obj = this.all_card_type.filter(item => item.id == val)[0];
        this.effect_text =
          obj.name + "有效期" + this.infoForm.add_renewal_days + "天";
      } else {
        let text = "";
        val.forEach(item => {
          for (let el of this.all_card_type) {
            if (el.id == item) {
              text +=
                el.name + "有效期" + Math.ceil(el.valid_day / 8.64e4) + "天，";
              break;
            }
          }
        });
        this.effect_text = text ? text.substr(0, text.length - 1) : "";
      }
    },
    //卡类型切换
    cardTypeChange(val) {
      this.$refs.infoForm.resetFields();
      this.add_score_type = false;
      this.add_ticket_type = false;
      this.infoForm.support_buy = "0";
      this.infoForm.support_score = "0";
      this.infoForm.support_ticket = "0";
      this.pay_voucher = "0";
      if (this.basicForm.second_type == 2) {
        // 办卡
        let obj = this.all_card_type.filter(item => item.id == val)[0];
        this.isCancel = obj.is_cancel == 1;
        this.isLimit = obj.is_limit == 1;
        this.choose_card_type = obj.type;
        this.choose_card_init = obj.initial_balance
          ? obj.initial_balance / 1
          : 0;
        this.infoForm.add_renewal_days = Math.ceil(obj.valid_day / 8.64e4);
        this.getEffEctText(val);
      } else {
        // 其他
        if (val.length > 1) {
          let lastObj = this.all_card_type.filter(
            item => item.id == val[val.length - 1]
          )[0];
          this.choose_card_type = lastObj.type;
          let firstObj = this.all_card_type.filter(
            item => item.id == val[0]
          )[0];
          if (firstObj.type != lastObj.type) {
            let obj = this.card_type_list.filter(
              item => item.type == firstObj.type
            )[0];
            obj.list.forEach(item => {
              for (let i in val) {
                if (val[i] == item.id) {
                  val.splice(i, 1);
                  break;
                }
              }
            });
          }
        } else if (val.length == 1) {
          let obj = this.all_card_type.filter(item => item.id == val[0])[0];
          this.choose_card_type = obj.type;
        }
        this.supCardDisabled = val.length > 1;
        this.getEffEctText(val);
      }
    },
    // 赠送 续期切换
    opCheckedChange(val, i) {
      if (i == 1) {
        this.infoForm.add_score = "";
        this.$refs.add_score.clearValidate();
      } else if (i == 2) {
        this.infoForm.add_ticket = "";
        this.$refs.add_ticket.clearValidate();
      } else if (i == 3) {
        this.infoForm.add_renewal_days = "";
        this.$refs.add_renewal_days.clearValidate();
      } else if (i == 4) {
        this.infoForm.pay_money = "";
        this.$refs.money_renewal.clearValidate();
      } else if (i == 5) {
        this.infoForm.pay_score = "";
        this.$refs.pay_score.clearValidate();
      } else if (i == 6) {
        this.infoForm.pay_money = "";
        this.$refs.get_money.clearValidate();
      } else if (i == 7) {
        this.infoForm.pay_score = "";
        this.$refs.get_score.clearValidate();
      } else if (i == 8) {
        this.infoForm.pay_ticket = "";
        this.$refs.get_ticket.clearValidate();
      } else if (i == 9) {
        this.infoForm.pay_voucher_name = "";
        this.infoForm.pay_voucher_num = "";
        this.$refs.pay_voucher_name.clearValidate();
        this.$refs.pay_voucher_num.clearValidate();
      } else if (i == 10) {
        this.infoForm.pay_accompany_money = "";
        this.$refs.pay_accompany_money.clearValidate();
      } else if (i == 11) {
        this.infoForm.card_effective_days = "";
        this.$refs.card_effective_days.clearValidate();
      }
    },
    //  角标
    cornerClick(i) {
      if(this.isNew==3||this.isDisabled||this.basicForm.second_type==8){
        return ;
      }
      this.infoForm.corner_mark = this.infoForm.corner_mark == i ? "" : i;
    },
    storeRadioChange(i) {
      if (i === "0") {
        this.check_store_list = [];
      }
    },
    timeRadioChange(val) {
      if (val === "1") {
        this.timeForm.intime = "";
        this.$refs.intimeForm.clearValidate();
      } else {
        this.timeForm.pickerTime = pickerDateDot();
      }
    },
    weekChange(val) {
      if (!val) {
        this.timeForm.week_day = [];
        this.$refs.weekDayForm.clearValidate();
      }
    },
    timeChange(val) {
      if (!val) {
        this.timeForm.clock_time = ["00:00:00", "23:59:59"];
      }
    },
    disDayChange(val) {
      if (!val) {
        this.timeForm.disable_date = "";
        this.dis_day_list = [];
      }
    },
    //不可用日期弹窗
    editDisDayClick() {
      this.current_dis_day = "";
      this.dis_day_list = this.timeForm.disable_date
        ? this.timeForm.disable_date.split("，")
        : [];
      this.disDayDialog = true;
    },
    //添加不可用日期
    addDisDayClick() {
      if (this.current_dis_day) {
        let index = this.dis_day_list.findIndex(
          val => val == this.current_dis_day
        );
        if (index == -1) {
          this.dis_day_list.push(this.current_dis_day);
        }
        this.current_dis_day = "";
      } else {
        this.$message.error("请选择日期");
      }
    },
    //移除不可用日期
    delDisDay(i) {
      this.dis_day_list.splice(i, 1);
    },
    //清空不可用日期
    clearAllDisDay() {
      this.dis_day_list = [];
    },
    confirmDisDay() {
      this.dis_day_list.sort(
        (a, b) => new Date(a).getTime() - new Date(b).getTime()
      );
      this.timeForm.disable_date = this.dis_day_list.join("，");
      this.disDayDialog = false;
    },
    saveClick() {
      if (!this.verify()) {
        return;
      }
      this.$confirm(
        "请确保信息内容设置无误，保存后部分信息将不能修改，是否继续？",
        "提示",
        {
          confirmButtonText: "确定继续",
          cancelButtonText: "返回修改",
          showClose: false,
          closeOnClickModal: false,
          closeOnPressEscape: false,
          type: "warning"
        }
      ).then(() => {
        this.save();
      });
    },
    save() {
      // 1
      let data = JSON.parse(JSON.stringify(this.infoForm));
      data.pay_money *= 100;
      data.pay_accompany_money = data.pay_accompany_money?data.pay_accompany_money*100:"";
      data.name = this.basicForm.name;
      data.type = this.basicForm.type;
      data.second_type = this.basicForm.second_type;
      data.describe = this.basicForm.describe;
      data.card_type_id =
        this.basicForm.second_type == 2
          ? this.basicForm.card_type_id
          : this.basicForm.more_card_type_id.join();
      data.tab = data.tab.join();
      data.support_buy = this.basicForm.second_type < 4 ||this.basicForm.second_type ==5 ? 1 : data.support_buy;
      data.add_adult_tickets=data.second_type==5?data.add_adult_tickets:0;
      data.add_child_tickets=data.second_type==5?data.add_child_tickets:0;
      data.add_item_num=data.second_type==7?1:data.add_item_num;
      data.support_store=data.second_type==7?1:data.support_store;
      // 2
      data.chose_store_type = this.storeRadio;
      data.store_list =
        this.storeRadio === "2" ? this.check_store_list.join() : "";
      // 3
      data.chose_time_type = data.second_type > 4 ? this.timeRadio : "";
      data.effect_time =
        data.second_type > 4 && data.second_type != 8 && this.timeRadio === "1"
          ? this.timeForm.pickerTime.join()
          : this.timeForm.intime;
      data.week_day = this.timeForm.week ? this.timeForm.week_day.join() : "";
      data.disable_date = this.timeForm.dis_day
        ? this.timeForm.disable_date.replace(/，/g, ",")
        : "";
      data.clock_time = this.timeForm.time
        ? this.timeForm.clock_time.join()
        : "";
      goodsCreate({ data, second_type: data.second_type }).then(res => {
        if (res.code == 1) {
          this.$message.success(res.message);
          this.$confirm("创建成功，是否新建销售设置？", "提示", {
            confirmButtonText: "前往设置",
            cancelButtonText: "返回列表",
            showClose: false,
            closeOnClickModal: false,
            closeOnPressEscape: false,
            type: "warning"
          })
            .then(() => {
              this.goBack();
              this.goSale(1, res.data);
            })
            .catch(() => {
              this.goBack();
            });
        }
      });
    },
    editClick(i) {
      if (i == 1) {
        this.isDisabled = true;
        if (this.tab_step == 1) {
          this.basicForm = JSON.parse(this.oldBasicData);
          this.infoForm = JSON.parse(this.oldInfoData);
          this.add_score_type = this.oldTypeData.add_score_type;
          this.add_ticket_type = this.oldTypeData.add_ticket_type;
          this.getEffEctText(
            this.basicForm.second_type == 2
              ? this.basicForm.card_type_id
              : this.basicForm.more_card_type_id
          );
        } else if (this.tab_step == 2) {
          // let store_list = JSON.parse(JSON.stringify(this.choose_store_list));
          // this.choose_store_list = store_list;
          this.storeRadio = this.oldStoreData.storeRadio;
          this.check_store_list = JSON.parse(
            this.oldStoreData.check_store_list
          );
        } else if (this.tab_step == 3) {
          let data = JSON.parse(this.oldTimeData);
          this.timeRadio = data.intime == "" ? "1" : "2";
          this.timeForm = data;
        }
      } else if (i == 2) {
        if (!this.verify()) {
          return;
        }
        let data = {
          goods_id: this.id,
          steps: this.tab_step,
          update_time: this.update_time,
          data: {}
        };
        if (this.tab_step == 1) {
          if (
            this.oldInfoData == JSON.stringify(this.infoForm) &&
            this.oldBasicData == JSON.stringify(this.basicForm)
          ) {
            this.isDisabled = true;
            return;
          }
          let obj = JSON.parse(JSON.stringify(this.infoForm));
          obj.pay_money *= 100;
          obj.pay_accompany_money *= 100;
          obj.name = this.basicForm.name;
          obj.type = this.basicForm.type;
          obj.second_type = this.basicForm.second_type;
          obj.describe = this.basicForm.describe;
          obj.card_type_id =
            this.basicForm.second_type == 2
              ? this.basicForm.card_type_id
              : this.basicForm.more_card_type_id.join();
          obj.tab = obj.tab.join();
          obj.support_buy = this.basicForm.second_type < 4 ||this.basicForm.second_type ==5 ? 1 : obj.support_buy;
          data.data = obj;
        } else if (this.tab_step == 2) {
          if (
            this.oldStoreData.storeRadio == this.storeRadio &&
            this.oldStoreData.check_store_list ==
              JSON.stringify(this.check_store_list)
          ) {
            this.isDisabled = true;
            return;
          }
          data.data.chose_store_type=this.storeRadio;
          data.data.store_list =
            this.storeRadio === "2" ? this.check_store_list.join() : "";
        } else if (this.tab_step == 3) {
          if (this.oldTimeData == JSON.stringify(this.timeForm)) {
            this.isDisabled = true;
            return;
          }
          data.data.chose_time_type = this.timeRadio;
          data.data.effect_time =
            this.basicForm.second_type > 4 && this.timeRadio === "1"
              ? this.timeForm.pickerTime.join()
              : this.timeForm.intime;
          data.data.week_day = this.timeForm.week
            ? this.timeForm.week_day.join()
            : "";
          data.data.clock_time = this.timeForm.time
            ? this.timeForm.clock_time.join()
            : "";
          data.data.disable_date = this.timeForm.dis_day
            ? this.timeForm.disable_date.replace(/，/g, ",")
            : "";
        } else {
          this.$message.error("操作失败，请返回重试");
          return;
        }
        goodsUpdate(data).then(res => {
          if (res.code == 1) {
            this.$message.success(res.message);
            this.isDisabled = true;
            if (this.tab_step == 1) {
              this.oldBasicData = JSON.stringify(this.oldBasicData);
              this.oldInfoData = JSON.stringify(this.infoForm);
              this.oldTypeData = {
                add_score_type: this.add_score_type,
                add_ticket_type: this.add_ticket_type
              };
            } else if (this.tab_step == 2) {
              this.oldStoreData = {
                storeRadio: this.storeRadio,
                check_store_list: this.check_store_list
              };
            }
          }
        });
      } else {
        this.isDisabled = false;
        if (this.tab_step == 2) {
          this.choose_store_list.forEach(val => {
            val.disabled = false;
            this.isSelled &&
              this.check_store_list.forEach(item => {
                if (item == val.id) {
                  val.disabled = true;
                }
              });
          });
        }
      }
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.customContainer {
  overflow-y: auto;
}
.info {
  background: #fff;
  padding: 30px 0 10px;
  margin-bottom: 20px;
  .info_remark {
    margin-left: 20px;
    color: #606266;
  }
  .remark {
    margin: 20px;
    margin-left: 0px;
    color: #606266;
  }
  .info_optional {
    padding: 0 20px;
    .op_title {
      margin: 30px 0 20px;
      font-size: 16px;
      font-weight: bold;
      color: #282828;
      border-bottom: 1px solid #dcdfe6;
    }
    .op_voucher {
      margin-top: 20px;
      display: flex;
      align-items: center;
      .op_voucher_item {
        display: inline-block;
      }
    }
  }
  .op_col {
    position: relative;
    width: 300px;
    height: 40px;
    .op_checked {
      position: absolute;
    }
    .op_item {
      display: flex;
    }
    .op_renewal {
      margin-left: 100px;
    }
    .op_remark {
      margin-left: 20px;
      color: #606266;
      max-width: 800px;
    }
  }
  .op_col.w {
    width: 100%;
  }
  .store_choose {
    min-width: 960px;
    margin-bottom: 30px;
  }
}
.goods {
  padding: 30px 30px 10px;
  .store_info {
    margin: 50px 0 180px;
    color: #bbb;
    font-size: 16px;
  }
  .time_info {
    margin: 20px 0 0 20px;
    .remark {
      color: #606266;
      margin-top: 10px;
    }
    .intime {
      display: flex;
      .intime_item {
        margin: 0 10px;
      }
    }
    .dis_day_text {
      line-height: 25px;
      color: #606266;
    }
  }
  .time_title {
    margin-bottom: 10px;
  }
  .time_item {
    margin-top: 0;
    font-size: 14px;
  }
}
.add_type {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  .add_type_info {
    width: 80px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    cursor: pointer;
  }
  .add_type_info:hover {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
  }
}
.tab_title {
  width: 200px;
  font-size: 20px;
  font-weight: bold;
  margin: 5px 0 20px 70px;
}

.transferHeader {
  width: 400px;
  margin-top: 30px;
  display: inline-block;
}
.transferHeader + .transferHeader {
  margin-left: 145px;
}

div.check_meal {
  border: 1px solid #ccc;
  padding: 10px 10px 0;
  margin-bottom: 20px;
  height: 85px;
  overflow: auto;
  div.check_meal_list {
    display: flex;
    flex-wrap: wrap;
    div.check_meal_item {
      font-size: 12px;
      border: 1px solid #409eff;
      color: #409eff;
      border-radius: 5px;
      padding: 3px 5px;
      margin: 0 10px 10px 0;
      position: relative;
      .el-icon-close {
        font-size: 14px;
        margin-left: 5px;
        padding: 2px;
        cursor: pointer;
        &:hover {
          background-color: #409eff;
          color: #fff;
          border-radius: 50%;
        }
      }
    }
  }
}
div.check_meal.dis_day {
  margin-bottom: 0;
}
.dis_day_btn {
  margin-bottom: 20px;
}
// .info /deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
//     background-color: #409EFF;
//     border-color: #409EFF;
// }
// .info /deep/ .el-radio__input.is-disabled.is-checked .el-radio__inner  {
//     background-color: #409EFF;
//     border-color: #409EFF;
// }
</style>